Building and Packaging

  • compiler options - How do I make an ABI binary
  • linker options - What if I have to use ld?
  • assembly language - Integrating PIC assembly language
  • compliance - How to check if it's ABI compliant?
  • dynamic shared objects - Building and shipping DSOs
  • on-site - Shipping objects and libraries: on-site linking
  • distribution - Distribution and media formats
  • installation locations - Where to install programs and data
  • debugging - How to debug an ABI application
  • dso needed - Finding what DSOs a program needs
  • How do I make an ABI binary?

    On the IRIX Reference Platform, a wrapper shell script is supplied to provide command-line options compatible with those for the Software Generation System (SGS) described in the SVID 3. This script is supported on all Conformance Guide 1.1 compliant platforms, providing a mechanism for delivering software systems which are used by the end-user to construct tailored applications. It is also the preferred method for constructing ABI applications on the RP. This script is called abicc.

    Using abicc allows the specific compiler calling conventions to be hidden. The specific invocation for three different revisions of the Reference Platform are noted in the rest of this section. Each is different, and there is no guarantee that the methods will not continue to change. Thus, the suggested compilation method is simply to set an equate in the Makefile:

    CC = abicc On IRIX 5.2 with the IRIS Development Option 3.18, the -abi flag to cc is sufficient to generate an ABI binary.

    On IRIX 5.1 with the IRIS Development Option 3.17, the following command line flags to the compiler are needed:

    -abi -Wl,-abi -D_ABI_SOURCE -L -L/usr/lib/abi -I/usr/include/abi Note that the sequence -L -L/usr/lib/abi is very important, searching the standard IRIX library paths must be turned off.

    On RISC/os 5.01 with ANSI C 3.11, the following command line switches are used with /svr4/bin/cc:

    -SYSTYPE_SVR4 -KPIC -std0 -G0 Actually, all of those flags are not strictly necessary if the SVR4 cc driver is used, but it may be safest to include them.

    What if I have to use ld directly?

    On the IRIX Reference Platform, a wrapper shell script is supplied to provide command-line options compatible with those for the Software Generation System (SGS) described in the SVID 3. This script is supported on all Conformance Guide 1.1 compliant platforms, providing a mechanism for delivering software systems which are used by the end-user to construct tailored applications. It is also the preferred method for constructing ABI applications on the RP. This script is called abild.

    Using abild allows the specific compiler calling conventions to be hidden. The specific invocation for three different revisions of the Reference Platform are noted in the rest of this section. Each is different, and there is no guarantee that the methods will not continue to change. Thus, the suggested compilation method is simply to set an equate in the Makefile:

    LD = abild On IRIX 5.2 with the IRIS Development Option 3.18, the -abi flag to ld is sufficient to generate an ABI binary.

    On IRIX 5.1 with the IRIS Development Option 3.17, the following command line flags to the compiler are needed:

    -abi -L -L/usr/lib/abi Note that the sequence -L -L/usr/lib/abi is very important, searching the standard IRIX library paths must be turned off.

    On RISC/os 5.01 with ANSI C 3.11, the following command line switches are used with /svr4/bin/ld:

    -SYSTYPE_SVR4 -KPIC -std0 -G0 Actually, all of those flags are not strictly necessary if the SVR4 ld driver is used, but it may be safest to include them.

    If ld is to be used directly, it is useful to study the output of cc -abi -v to get the flags and run-time startup files correct.

    Integrating PIC assembly language

    Assembler code that is to be compiled in with an ABI application must be Position-Independent Code (PIC). There are a number of considerations here; for example the register usage conventions of the ABI must be observed. If the file is assembled directly by as, the -KPIC option must be supplied in order to activate the PIC directives. It is suggested that assembly language be assembled by the use of the abicc script rather than calling as directly. The code itself must contain a directive to produce PIC code:

    .option pic2 Note that the assembly language format is not standardized by the ABI, so much care must be taken with assembly language which is to be used for "on-site linking"; in fact, it may not be possible. Standardizing the assembly language interface is under consideration by the MIPS ABI Group as a future direction.

    How to check if it's ABI compliant?

    If the program links correctly using the proper compiler switches, there is a tool which can be used to check the dangling references in an executable and make sure there are none outside the ABI. This tool is called check_abi_compliance. It reports references that are outside the ABI, and also missing references that are required by the ABI.

    The tool check_for_syscalls can be used to check that an executable makes no system calls directly. All system calls are to be made by ABI-specified DSOs.

    On the IRIX Reference Platform, elfdump can be used to examine information about an ELF file. . A combination of dump and ldd may provide similar functionality on other platforms.

    More sophisticated application checkers are under development and will be available in the future.

    Building and shipping DSOs

    It is quite reasonable to deliver custom DSOs as part of an application. ABI programs must use always Position Independent Code for calls to DSOs, and the DSO library must follow PIC conventions at the call point. The IRIX RP compilers generate PIC by default; on the RP for the 1.0 Conformance Guide (RISC/os), the -KPIC and -G0 options were necessary.

    On IRIX 5.2, abild should be used to make the DSO. It takes the -G flag to do this. On IRIX 5.1, the -shared flag is needed. Note that abicc is not able to make a DSO directly, the objects need to be built first, then abild called to link the DSO.

    If DSOs are attached via dlopen, some care must be taken with the visibility of symbols. To check a DSO to make sure it is ABI compliant, run check_abi_interface on it. It may be worthwhile to construct a list of entry points in the DSO and install it in /usr/lib/abi/data. In this way, the interfaces provided by the DSO can be checked to make sure that they don't accidentally pull in non-ABI interfaces from other libraries (for example, references to gethostname, which is not part of the ABI).

    Shipping objects and libraries: On-site linking

    If an application includes a construction kit which is used by the end-user to make a binary, there are a few issues to consider.

    First, the compilation environments on the different systems come from different sources, so getting the right arguments and flags on each system can be pretty tricky, and in particular, may require testing on each platform to get them right, which is at odds with the Reference Platform concept. To alleviate this problem, all the system suppliers have agreed to provide "standard" compiler wrappers abicc and abild that interpret arguments and flags from the SVR4 SGS.

    Another potential problem is that libraries and include files outside the ABI are not guaranteed to be identical on all systems. Problems from this can only be avoided by careful planning when executing the port, and a thorough understanding of what is supported by the ABI. When linking an executable on the Reference Platform it is permissible to link in code from static archives that are not explicitly specified by the ABI, as long as those routines do not themselves use non-abi facilities. This has the potential for problems for on-site linkage, since it may cause differences in behavior if those static archives are implemented differently on the target than on the Reference Platform. Programs which are fully linked on the RP, on the other hand, will be consistent since they'll always have the RP version. Thus, caution is advised when requiring non-ABI libraries for an on-site linking situation.

    Note that when ABI compliant libraries and object files are linked on a target system, the ABI specification does not require that the resulting executable be ABI compliant. However, the resulting binary must run on the target system if all the pieces of the original application were ABI compliant and the application would have run if linked on the Reference Platform.

    As specific examples, the Math library, libm.a, is guaranteed to be compatible on all the ABI platforms, and can safely be used for on-site linkage.

    The curses library (libcurses) is known to depend on private interfaces in libc.so.1 and should not be used for programs which will be on-site linked, and probably should be completely avoided except for queries (obtaining terminal information should be safe).

    The BSD compatibility library (libucb) may be incompatible across versions and should be avoided for on-site linkage.

    The Motif library is a supported ABI library, and the ABI platform vendors have pledged to "make it work", but application vendors should take care to not depend too heavily on specific features of any specific OSF minor release. The release notes for the application should document the version of Motif it was built against for reference purposes.

    Distribution and media formats

    An ABI application may be packaged for delivery either using the SVR4 packaging tools (pkgmk, pkgtrans, etc.), or use their own packaging and installation tools. In the latter case, tools must be restricted to those defined in chapter 8 of the gABI and the Conformance Guide.

    Nodes for standard devices are provided in /dev/abi. See Chapter 2 of the Black Book for the device names.

    Where to install programs and data

    According the the gABI, an application collectively called pkg should install static package objects in /opt/pkg, package objects that change in normal operations (such as log files) in /var/opt/pkg, and machine-specific configuration files in /etc/opt/pkg. Only package objects that must reside in specific locations within the system file tree in order to function properly (e.g., special files in /dev) should be installed in those locations.

    The Black Book extends these requirements slightly for efficiency reasons (to keep search paths short); for example executable objects installed in /opt/pkg/bin may symbolically link files to /opt/bin. See the Black Book for details.

    ABI platforms are required to provide the directories /opt/bin, /opt/man, and /opt/include.

    When constructing installation scripts or pkgmap files, be aware that the /opt subtree may well be symbolically linked to someplace else - any existing links should be preserved.

    How to debug an ABI application